
#include <iostream>
#include <queue>

using namespace std;

class Student{
public:
	Student(string const& name="", int age=0):m_name(name), m_age(age){}
	bool operator<(Student const& that) const {
		return m_age < that.m_age;
	}
	bool operator>(Student const& that) const {
		return m_age > that.m_age;
	}
private:
	string m_name;
	int m_age;
	friend ostream& operator<<(ostream& os, Student const& stu);
};

ostream& operator<<(ostream& os, Student const& stu){
	return os << stu.m_name << " : " << stu.m_age;
}

int main(){
	priority_queue<Student, vector<Student>, greater<Student> > pq;
	pq.push(Student("zhangsan", 22));
	pq.push(Student("lisi", 25));
	pq.push(Student("wangwu", 30));
	pq.push(Student("maliu", 12));
	pq.push(Student("qi", 90));

	while(!pq.empty()){
		cout << pq.top() << endl;
		pq.pop();
	}
	return 0;
}
